<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./echarts.min.js"></script>
  </head>
  <body>
    <div id="main" style="width: 800px; height: 400px"></div>
    <script>
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.querySelector('#main'))

      const option = {
        title: {
          text: '班级薪资分布',
          top: '20',
          left: '10',
        },
        tooltip: {
          trigger: 'item',
        },
        legend: {
          bottom: '5%',
          left: 'center',
        },
        series: [
          {
            name: '班级薪资分布',
            type: 'pie',
            radius: ['60%', '50%'],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: '#fff',
              borderWidth: 2,
            },
            label: {
              show: false,
              position: 'center',
            },
            emphasis: {
              label: {
                show: false,
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 20, name: '一万以下' },
              { value: 22, name: '1-1.5万' },
              { value: 40, name: '1.5-2万' },
              { value: 30, name: '2万以上' },
            ],
            color: ['#fda224', '#5097ff', '#3fceff', '#34d39a'],
          },
        ],
      }

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option)
    </script>
  </body>
</html>
